package com.administrator.customviewtest.kotlin

import android.content.Context
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Toast
import android.widget.Toolbar
import java.util.*

/**
 * Created by Administrator on 2017/6/15.
 */
//函数篇

fun sum(a: Int, b: Int): Int {


    return a + b


}

fun sum(a: Int, b: Int, c: Int) = a + b + c
fun and(a: Int, b: Int): Unit {
    System.out.print("sfdsfd")
}

fun and(a: Int, b: Int, c: Int) {
    var sentence: String? = null

    System.out.print(sentence)

}

class MyAct : AppCompatActivity() {
    var toolbar: Toolbar = Toolbar(this)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        showToast(this,"sss")
    }
}
val a: Int = 1
val b = 2
var c: Int? = null
var d = "c is $c"

fun showToast(context:Context,message:String){
    Toast.makeText(context,message,Toast.LENGTH_LONG).show();
}
var stringRepresentation: String
    get() = "sss"
    set(value) {
        value+"s" // 解析字符串并赋值给其他属性
    }

fun maxOf(a: Int, b: Int) = if (a > b) a else b

fun parseInt(str: String): Int? = null

val items = Arrays.asList("1", "2")


fun ands(a: Int, b: Int, c: Int) {
    var sentence: String? = null
    for (item in items) {

    }
    loop@ for (i in 1..100) {
        for (j in 1..100) {
            if (j == 50) break@loop
        }
    }
    System.out.print(sentence)

}

private class SS(var s: Int) {
    var ss = s;

}





